#Boa:Frame:Frame_Relatorio

import wx
from ControlePagamento import *
import random

def create(parent):
    return Frame_Relatorio(parent)

[wxID_FRAME_RELATORIO, wxID_FRAME_RELATORIOBUTTON1, 
 wxID_FRAME_RELATORIOPANEL1, wxID_FRAME_RELATORIOSTATICBOX1, 
 wxID_FRAME_RELATORIOSTATICLINE1, wxID_FRAME_RELATORIOSTATICTEXT1, 
 wxID_FRAME_RELATORIOSTATICTEXT2, wxID_FRAME_RELATORIOSTATICTEXT3, 
 wxID_FRAME_RELATORIOWINDOW1, 
] = [wx.NewId() for _init_ctrls in range(9)]

class Frame_Relatorio(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME_RELATORIO,
              name=u'Frame_Relatorio', parent=prnt, pos=wx.Point(529, 147),
              size=wx.Size(341, 314), style=wx.DEFAULT_FRAME_STYLE,
              title=u'Frame_Relatorio')
        self.SetClientSize(wx.Size(325, 276))

        self.panel1 = wx.Panel(id=wxID_FRAME_RELATORIOPANEL1, name='panel1',
              parent=self, pos=wx.Point(0, 0), size=wx.Size(325, 276),
              style=wx.TAB_TRAVERSAL)

        self.staticText1 = wx.StaticText(id=wxID_FRAME_RELATORIOSTATICTEXT1,
              label=u'Relat\xf3rio B\xe1sico', name='staticText1',
              parent=self.panel1, pos=wx.Point(76, 16), size=wx.Size(172, 29),
              style=0)
        self.staticText1.SetFont(wx.Font(18, wx.SWISS, wx.ITALIC, wx.NORMAL,
              False, u'Tahoma'))
        self.staticText1.Center(wx.HORIZONTAL)

        self.staticLine1 = wx.StaticLine(id=wxID_FRAME_RELATORIOSTATICLINE1,
              name='staticLine1', parent=self.panel1, pos=wx.Point(82, 56),
              size=wx.Size(160, 2), style=0)
        self.staticLine1.Center(wx.HORIZONTAL)

        self.window1 = wx.Window(id=wxID_FRAME_RELATORIOWINDOW1, name='window1',
              parent=self.panel1, pos=wx.Point(62, 80), size=wx.Size(200, 128),
              style=0)
        self.window1.Center(wx.HORIZONTAL)

        self.staticBox1 = wx.StaticBox(id=wxID_FRAME_RELATORIOSTATICBOX1,
              label=u'Receita Total do Estabelecimento', name='staticBox1',
              parent=self.window1, pos=wx.Point(8, 8), size=wx.Size(184, 112),
              style=0)

        self.staticText2 = wx.StaticText(id=wxID_FRAME_RELATORIOSTATICTEXT2,
              label=u'<Valor>', name='staticText2', parent=self.window1,
              pos=wx.Point(40, 56), size=wx.Size(69, 19), style=0)
        self.staticText2.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Tahoma'))
        self.staticText2.SetForegroundColour(wx.Colour(0, 128, 0))

        self.staticText3 = wx.StaticText(id=wxID_FRAME_RELATORIOSTATICTEXT3,
              label=u'R$', name='staticText3', parent=self.window1,
              pos=wx.Point(120, 56), size=wx.Size(26, 23), style=0)
        self.staticText3.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, u'Tahoma'))

        self.button1 = wx.Button(id=wxID_FRAME_RELATORIOBUTTON1,
              label=u'Voltar', name='button1', parent=self.panel1,
              pos=wx.Point(125, 224), size=wx.Size(75, 31), style=0)
        self.button1.Center(wx.HORIZONTAL)
        self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
              id=wxID_FRAME_RELATORIOBUTTON1)

    def __init__(self, parent):
        self._init_ctrls(parent)
        
        self.receita = 0
        cp = ControlePagamento()
        cp.verificarArquivo()
        
        for x in cp.getListaDePagamento():
            self.receita += float(x.GetValor())
            
        self.staticText2.SetLabel(str(self.receita))

    def OnButton1Button(self, event):
        self.Close()
